package logic.bean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import logic.util.Util;

/**
 * 专区模块的对象bean
 * 
 * @author zouqp
 * @date 2015-01-15
 */
public class RegionModuleBean implements Serializable {
	private static final long serialVersionUID = -1782469404657833866L;
	private static String[]  colors = {"ff3ba5de", "ffa1ca2f", "fff08b36", "ffea5b27", "ff5f67ae", "ffe95a6f"};

	private long moduleId;//模块id
	private String moduleName;//模块名称
	private String moduleBackgroundColor;//模块背景色
	private long enterpriseId;//企业id
	private long publishTime;//模块发布时间
	private String moduleType;//模块类型，1=内容型(普通) 2=外链型 3=客户端型（功能）
	private String moduleTypeValue;//针对模块类型2和3类型对应的模块类型值
	private String writeSource;//模块来源类型，1|2：企业来源|运营来源

	private String subModuleName;//子模块名
	private String subTargetValus;//子模块

	public String getSubModuleName() {
		return subModuleName;
	}

	public void setSubModuleName(String subModuleName) {
		this.subModuleName = subModuleName;
	}

	public String getSubTargetValus() {
		return subTargetValus;
	}
	public void setSubTargetValus(String subTargetValus) {
		this.subTargetValus = subTargetValus;
	}

	public long getModuleId() {
		return moduleId;
	}
	public void setModuleId(long moduleId) {
		this.moduleId = moduleId;
	}
	public String getModuleName() {
		return moduleName;
	}
	public void setModuleName(String moduleName) {
		this.moduleName = moduleName;
	}
	public String getModuleBackgroundColor() {
		return moduleBackgroundColor;
	}
	public void setModuleBackgroundColor(String moduleBackgroundColor) {
		this.moduleBackgroundColor = moduleBackgroundColor;
	}
	public long getEnterpriseId() {
		return enterpriseId;
	}
	public void setEnterpriseId(long enterpriseId) {
		this.enterpriseId = enterpriseId;
	}
	public long getPublishTime() {
		return publishTime;
	}
	public void setPublishTime(long publishTime) {
		this.publishTime = publishTime;
	}
	public String getModuleType() {
		return moduleType;
	}
	public void setModuleType(String moduleType) {
		this.moduleType = moduleType;
	}
	public String getModuleTypeValue() {
		return moduleTypeValue;
	}
	public void setModuleTypeValue(String moduleTypeValue) {
		this.moduleTypeValue = moduleTypeValue;
	}
	public String getWriteSource() {
		return writeSource;
	}
	public void setWriteSource(String writeSource) {
		this.writeSource = writeSource;
	}
	
	public int getModuleColor( ) {
		String color = moduleBackgroundColor;
		int intColor = 0;
		if(Util.isEmpty(color)){
			color = "ff3ba5de";
		}
		try 
		{
			intColor = Util.OxStringtoInt(color);
		} catch( Exception e ) {
			intColor = 0xff3ba5de;
		}
		return intColor;
	}
    
    public static List<RegionModuleBean>  generateFakeModule( int count) {
    	List<RegionModuleBean> models = new ArrayList<RegionModuleBean>();
    	count = count > 6 ? 6 : count ;
    	for (int i = 0 ; i < count ; i++ ) {
        	RegionModuleBean model = new RegionModuleBean() ;
        	int id = i + 1;
        	model.setModuleId(id);
        	model.setModuleName("栏目" + id);
        	model.setModuleBackgroundColor(colors[i]);
        	models.add(model);
    	}
    	return models;
    }
    
}
